﻿/*
 * Name:        SnkButton
 * Description: UI part that acts as a Button
 * 
 * TODO:        Complete the button code when working on menu
 *              SnkImgPanel uses same OnClick functionality, so I just added a this dummy class to inhert it ATM
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

using Gyvate.Worldspawn;
using Gyvate.Util;

namespace Gyvate.GFX
{
    internal class SnkButton : SnkLabel
    {
        protected string m_command;

        /*
         * Constructor with Dimensions2D param
         */
        public SnkButton(Game game, Dimensions2d dim)
            : base(game, dim)
        {
            m_command = "";
        }

        /*
         * Constructor with 2x Vector2f params that will be turned into Dimensions2d
         */
        public SnkButton(Game game, Vector2d pos, Vector2d size)
            : base(game, pos, size)
        {
            m_command = "";
        }

        /*
         * Sets command
         */
        public void SetCommand(string command)
        {
            m_command = command;
        }

        /*
         * Called when clicked
         */
        public virtual void OnClick()
        {
            m_game.PlaySound(Constants.SOUND_CLICK);
            m_game.GetUI().SendCommand(m_command);
        }
    }
}
